import {
  Column,
  CreateDateColumn,
  Entity,
  OneToMany,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { Theme } from './theme.entity';

export class BackgroundBase {
  @PrimaryGeneratedColumn('uuid')
  id: string;
  @Column({
    type: 'varchar',
    default: 'rgba(255,255,255,1)',
    comment: '颜色1',
    length: 25,
    name: 'background_one',
  })
  backgroundOne: string;
  @Column({
    type: 'varchar',
    default: 'rgba(0,0,0,1)',
    comment: '颜色2',
    length: 25,
    name: 'background_two',
  })
  backgroundTwo: string;
  @Column({
    type: 'varchar',
    length: 25,
    default: 'rgba(255,255,255,1)',
    comment: '背景颜色默认与背景色1值',
  })
  background: string;
  @Column({
    type: 'varchar',
    default: null,
    comment: '背景图片',
    name: 'background_image',
  })
  backgroundImage: string;
  @Column({
    type: 'varchar',
    default: 'to right',
    length: 25,
    comment:
      '渐变方向--{从上到下: to bottom, 从左到右: to right, 左上角到右下角: to bottom right}',
  })
  mode: string;
  @Column({
    type: 'boolean',
    default: false,
    comment: '开启渐变色',
    name: 'linear_gradient_status',
  })
  linearGradientStatus: boolean;
  @Column({
    type: 'int',
    comment: '删除标记 0-未删除 1-删除',
    name: 'is_delete',
    default: 0,
  })
  isDelete: number;
  @CreateDateColumn({
    type: 'timestamp',
    name: 'create_date',
    comment: '创建时间',
  })
  createDate: Date;

  @UpdateDateColumn({
    type: 'timestamp',
    name: 'update_date',
    comment: '更新时间',
  })
  updateDate: Date;
}

@Entity('sys_theme_background')
export class Background extends BackgroundBase {
  @OneToMany((type) => Theme, (theme) => theme.background)
  theme: Theme;
}
